package horncomb.bpm.process.def.state;

import horncomb.bpm.BpmContextHolder;
import horncomb.bpm.process.core.ExecutionContext;

/**
 * 嵌入流程状态节点定义.
 * <p>
 * 只是将其他流程定义的节点引入使用，达到流程复用。<BR>
 * 但并不创建新的子流程。
 * @author Daniel
 */
public class ReferedProcessStateDefinition extends AbstractProcessStateDefinition {
	private static final long serialVersionUID = -1828575074877437292L;

	/**
	 * @param id
	 */
	public ReferedProcessStateDefinition(String id) {
		super(id);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected void doEnter(ExecutionContext context) {
		super.doEnter(context);
		// 进入嵌入流程定义的状态
		BpmContextHolder.getContext().getProcessManagementService()
				.findProcessDefinition(this.getInnerProcessDefinitionId())
				.getStartState().enter(context);
	}
}
